package cn.wolfcode.luowowo.common.util;

import cn.wolfcode.luowowo.common.exception.LogicException;

/**
 * 断言工具
 */
public class AssertUtil {

    /**
     * 当value为空是，抛出异常
     */
    public static void hasLength(String value,String msg){
        if(value == null || "".equals(value.trim())){
            throw new LogicException(msg);
        }
    }

    public static void isEquals(String x1, String x2, String msg) {
        if(x1 == null || x2 == null){
            throw new RuntimeException("参数不能为null");
        }
        if(!x1.equals(x2)){
            throw new LogicException(msg);
        }
    }
}
